package com.ruoyi.net.service.impl;

import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.common.utils.uuid.IdUtils;
import com.ruoyi.net.domain.ElementBusiMtnChannelGrain;
import com.ruoyi.net.domain.ElementBusiMtnChannelGrainListVo;
import com.ruoyi.net.mapper.ElementBusiMtnChannelGrainMapper;
import com.ruoyi.net.service.IElementBusiMtnChannelGrainService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 网元-业务-MTN Channel-细粒度业务盘保护组Service业务层处理
 * 
 * @author net
 * @date 2024-12-08
 */
@Service
public class ElementBusiMtnChannelGrainServiceImpl implements IElementBusiMtnChannelGrainService 
{
    @Autowired
    private ElementBusiMtnChannelGrainMapper elementBusiMtnChannelGrainMapper;

    /**
     * 查询网元-业务-MTN Channel-细粒度业务盘保护组
     * 
     * @param id 网元-业务-MTN Channel-细粒度业务盘保护组主键
     * @return 网元-业务-MTN Channel-细粒度业务盘保护组
     */
    @Override
    public ElementBusiMtnChannelGrain selectElementBusiMtnChannelGrainById(String id)
    {
        return elementBusiMtnChannelGrainMapper.selectElementBusiMtnChannelGrainById(id);
    }

    /**
     * 查询网元-业务-MTN Channel-细粒度业务盘保护组列表
     * 
     * @param elementBusiMtnChannelGrain 网元-业务-MTN Channel-细粒度业务盘保护组
     * @return 网元-业务-MTN Channel-细粒度业务盘保护组
     */
    @Override
    public List<ElementBusiMtnChannelGrainListVo> selectElementBusiMtnChannelGrainList(ElementBusiMtnChannelGrain elementBusiMtnChannelGrain)
    {
        return elementBusiMtnChannelGrainMapper.selectElementBusiMtnChannelGrainList(elementBusiMtnChannelGrain);
    }

    /**
     * 新增网元-业务-MTN Channel-细粒度业务盘保护组
     * 
     * @param elementBusiMtnChannelGrain 网元-业务-MTN Channel-细粒度业务盘保护组
     * @return 结果
     */
    @Override
    public int insertElementBusiMtnChannelGrain(ElementBusiMtnChannelGrain elementBusiMtnChannelGrain)
    {
        String uuid = IdUtils.simpleUUID();
        if (StringUtils.isEmpty(elementBusiMtnChannelGrain.getId())) {
            elementBusiMtnChannelGrain.setId(uuid);
        }
        elementBusiMtnChannelGrain.setCreateBy(SecurityUtils.getUsername());
        elementBusiMtnChannelGrain.setCreateTime(DateUtils.getNowDate());
        elementBusiMtnChannelGrain.setUpdateBy(SecurityUtils.getUsername());
        elementBusiMtnChannelGrain.setUpdateTime(DateUtils.getNowDate());
        return elementBusiMtnChannelGrainMapper.insertElementBusiMtnChannelGrain(elementBusiMtnChannelGrain);
    }

    /**
     * 修改网元-业务-MTN Channel-细粒度业务盘保护组
     * 
     * @param elementBusiMtnChannelGrain 网元-业务-MTN Channel-细粒度业务盘保护组
     * @return 结果
     */
    @Override
    public int updateElementBusiMtnChannelGrain(ElementBusiMtnChannelGrain elementBusiMtnChannelGrain)
    {
        elementBusiMtnChannelGrain.setUpdateBy(SecurityUtils.getUsername());
        elementBusiMtnChannelGrain.setUpdateTime(DateUtils.getNowDate());
        return elementBusiMtnChannelGrainMapper.updateElementBusiMtnChannelGrain(elementBusiMtnChannelGrain);
    }

    /**
     * 批量删除网元-业务-MTN Channel-细粒度业务盘保护组
     * 
     * @param ids 需要删除的网元-业务-MTN Channel-细粒度业务盘保护组主键
     * @return 结果
     */
    @Override
    public int deleteElementBusiMtnChannelGrainByIds(String[] ids)
    {
        return elementBusiMtnChannelGrainMapper.deleteElementBusiMtnChannelGrainByIds(ids);
    }

    /**
     * 删除网元-业务-MTN Channel-细粒度业务盘保护组信息
     * 
     * @param id 网元-业务-MTN Channel-细粒度业务盘保护组主键
     * @return 结果
     */
    @Override
    public int deleteElementBusiMtnChannelGrainById(String id)
    {
        return elementBusiMtnChannelGrainMapper.deleteElementBusiMtnChannelGrainById(id);
    }
}
